extends Card


func play_on_release(card_view: CardView) -> void:
	var player = card_view.get_tree().get_first_node_in_group("player")
	var player_state: PlayerInBattleState = Globals.player_state
	var tween := card_view.create_tween()
	tween.tween_callback(Shake.state_play.bind(player, StateBar.STATE.SHIELD, get_final_shield()))
	if CardManager.round_data.shield >=  self.round_shield:
		player_state.next_point += 1
	#这里一定要比上面的参数大，要不然可能有线程问题，因为shake方法也是个tween实现的
	tween.tween_interval(0.21)
	await tween.finished
	Globals.player_state.shield += card_view.card.shield
	card_view.play_on_release_signal_finish.emit()
	CardManager.round_data.add_shield_monitor_card(card_view.card)

func after_round():
	if CardManager.round_data.shield >=  self.round_shield:
		CardManager.avail_point += self.restore_point
		Events.card_table_point_update.emit()
		
		
func get_desc() -> String:
	if desc_lab == "":
		return ""
	var text = (
		desc_lab
		% [
			self.shield,
			self.round_shield,
			self.restore_point
		]
	)
	return text


func init_from_csv(introduce):
	super.init_from_csv(introduce)
	self.shield = int(introduce[5])
	self.round_shield = int(introduce[6])
	self.restore_point = int(introduce[7])
